<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'list.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="resources/js/jquery-1.8.3.min.js"></script>
	<script type="text/javascript">
		
		function checkDel(id){
			var flag = window.confirm("确定要删除？");
				if(flag){
					location.href="<%=basePath%>JrInfoController/deleteJrInfo/"+id;
				}
		}
	</script>
  </head>
  
  <body>
    <center>
		<table border="1" cellpadding="10" cellspacing="0">
			
			<thead>
			<tr>
			<td colspan="6" style="text-align: center;">
			节日信息查询
			<span style='float:right;font-size: 16px;'>
			<a href='<%=basePath%>JrInfoController/toAdd' style='color: red;'>添加节日信息</a>
			</span>
			</td>
			</tr>
				<tr bgcolor="#C0C0C0" style="text-align: center;">
					<td width="100" >类型</td>
					<td width="100">节日名称</td>
					<td width="200">时间</td>
					<td width="400">简介</td>
					<td width="200"></td>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${requestScope.infos }" var="infos" >
					<tr style="text-align: center;">
						<c:choose>
							<c:when test="${infos.jrtype==0 }"><td>中国传统节日</td></c:when>
							<c:when test="${infos.jrtype==1 }"><td>网络节日</td></c:when>
							<c:when test="${infos.jrtype==2 }"><td>国际节日</td></c:when>
							<c:otherwise><td>历史上的今天</td></c:otherwise>
						</c:choose>
						<td >${infos.jrname }</td>
						<td>${infos.jrtime }</td>
						<td>${infos.jrxq }</td>
						<td style="text-align: center;"><a href="<%=basePath%>JrInfoController/editInfo/${infos.id }">修改</a>
						<a onclick="javascript:checkDel(${infos.id })">删除</a></td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</center>
    
  </body>
</html>
